import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpVipOrder {
  id!: number;
  uniacid!: number;
  userId!: number;
  ordercode!: string;
  outTradeNo!: string;
  totalPrice!: string;
  totalPayPrice!: string;
  sRemark?: unknown;
  submitTime!: string;
  isPay: boolean = false;
  payType?: number;
  payTime?: string;
  distributePrice?: string;
  surplusPrice?: string;
  vipData?: unknown;
  deviceType?: number;
  baidu?: unknown;
  payData?: unknown;
  cardId: number = 0;
  type?: boolean;
  day?: number;
}

export const ImsYzdKpVipOrderSchema = new EntitySchema({
  class: ImsYzdKpVipOrder,
  properties: {
    id: { primary: true, type: 'number' },
    uniacid: { type: 'number', index: 'uniacid' },
    userId: { type: 'number', index: 'user_id' },
    ordercode: { type: 'string', length: 255 },
    outTradeNo: { type: 'string', length: 255 },
    totalPrice: { type: 'string', columnType: 'numeric(10,2)' },
    totalPayPrice: { type: 'string', columnType: 'numeric(10,2)' },
    sRemark: { type: 'unknown', columnType: 'longtext', nullable: true },
    submitTime: { type: 'string', length: 255 },
    isPay: { type: 'boolean', default: false },
    payType: { type: 'number', nullable: true },
    payTime: { type: 'string', length: 255, nullable: true },
    distributePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    surplusPrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    vipData: { type: 'unknown', columnType: 'longtext', nullable: true },
    deviceType: { type: 'number', fieldName: 'deviceType', nullable: true },
    baidu: { type: 'unknown', columnType: 'longtext', nullable: true },
    payData: {
      type: 'unknown',
      fieldName: 'payData',
      columnType: 'longtext',
      nullable: true,
    },
    cardId: { type: 'number', default: 0, index: 'card_id' },
    type: { type: 'boolean', nullable: true, index: 'type' },
    day: { type: 'number', nullable: true },
  },
});
